package com.example.redis.collection;

import cn.hutool.core.collection.CollUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.stream.Collectors;

public class ToMap {
    public static void main(String[] args) {
        CollUtil.newArrayList(new Student(5,"ff"),new Student(1,"aa"), new Student(2,"bb")
                , new Student(3,"cc"), new Student(4,"dd"),new Student(4,"ee"))
                .stream().filter(i->!i.getName().equals("cc"))
//                .sorted((o1,o2)->o1.getId()-o2.getId())
                .collect(Collectors.toMap(Student::getId,Student::getName,(value1, value2)-> String.valueOf(666)))
                .forEach((key,value)-> System.out.println(key+"---->"+value));
    }

}
@Data
@AllArgsConstructor
@NoArgsConstructor
class Student{
    private int id;
    private String name;
}
